package org.webdb.webapp.picocontainer;

import java.lang.reflect.Type;

import javax.servlet.ServletContext;

import org.picocontainer.PicoCompositionException;
import org.picocontainer.PicoContainer;
import org.picocontainer.adapters.AbstractAdapter;

@SuppressWarnings("serial")
public class ServletContextAdapter extends AbstractAdapter<ServletContext> {

    private ServletContext servletContext;

    public ServletContextAdapter(Object key, ServletContext context) {
        super(key, ServletContext.class);
        this.servletContext = context;
    }

    @Override
    public ServletContext getComponentInstance(PicoContainer container,
            Type into) throws PicoCompositionException {
        return servletContext;
    }

    @Override
    public void verify(PicoContainer container) throws PicoCompositionException {

    }

    @Override
    public String getDescriptor() {
        return "ServletContext Adapter";
    }

}
